#ifdef __EOS__
#include <rtthread.h>
#else
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/printk.h>
#include <linux/version.h>
#include <linux/of_platform.h>
#endif

#include "ei_type.h"
#include "ei_common.h"
#include "ei_os.h"

extern int REGION_ModInit(void);
extern void REGION_ModExit(void);

#ifdef __EOS__

int region_driver_init(void)
{
	os_printk("region_driver_init\n");

	REGION_ModInit();

	return 0;
}

#else

static int ei_region_probe(struct platform_device *pdev)
{
    os_printk("%s\n", "region init ok");

    REGION_ModInit();

    return 0;
}

static int ei_region_remove(struct platform_device *pdev)
{
    os_printk("%s\n", "region exit ok");

    REGION_ModExit();

    return 0;
}

static const struct of_device_id ei_region_match[] = {
    { .compatible = "ei, ei-region" },
    {},
};

MODULE_DEVICE_TABLE(of, ei_region_match);

static struct platform_driver ei_region_driver = {
    .probe          = ei_region_probe,
    .remove         = ei_region_remove,
    .driver         =
    {
        .name           = "ei_region",
        .of_match_table = ei_region_match,
    },
};

os_module_platform_driver(ei_region_driver);

MODULE_LICENSE("Proprietary");

#endif /* __EOS__ */

